
<meta charset="UTF-8">

<script type="text/javascript">
var bjId1;
	$('#cc').combobox({
		onClick:function(record){
			bjId1=record.id;
			$('#XueShengYc').show();
				shuaxin3(bjId1);
			$('#XueShengsTable').datagrid('clearSelections');
			}     
	})
	
	function ckimg(id){
		var dg=$('<div style="display:none;">');
		dg.appendTo($('body'));
		var img=$('<img/>');
		img.attr('src','xuesheng/download?id='+id);
		img.attr('alt','加载失败');
		img.attr('width','100%');
		dg.append(img);
		dg.dialog({
		    title: '查看照片',
		    width:300,
		    closed: false,
		    cache: false,
		    modal: true,
		    height:'auto',
		    onClose:function(){
				dg.dialog('destroy');
				dg.remove();
			}        
		});
		dg.dialog('open');
	}
	
	function shuaxin3(bjId1){
		$('#XueShengsTable').datagrid($.extend({},$.crudgrid.defaults,{
			url:'xuesheng/page?bjId='+bjId1,
		    onLoadSuccess:function(data){  
	            $("a[name='opera']").linkbutton({text:'查看照片',plain:true,iconCls:'icon-man'});  
	   		 },
			dialog:{
				add:{
					title:'新增',
					href:'xuesheng/edit?bjId='+bjId1,
					action:'xuesheng/save',
					height:230
				},
				edit:{
					title:'修改',
					href:'xuesheng/edit',
					action:'xuesheng/save',
					height:230
				},
				search:{
					title:'查询',
					href:'xuesheng/search?bjId='+bjId1,
				},
				remove:{
					url:'xuesheng/delete',
					msg:'是否删除这条数据'
				},
				resetpwd:{
					url:'xuesheng/reset',
					msg:'是否重置密码'
				}
			},
			columns:[
				[
					{title:'cb',field:'cb',checkbox:true},
					{title:'序号',field:'id',width:200,hidden:true},
					{title:'学号',field:'stuNo',width:300},
					{title:'姓名',field:'name',width:200},
					{title:'照片',field:'filename',width:200,formatter: function(value,row,index){
		                if (row.filename){
		                	var str = '<a name="opera" onclick="ckimg(\''+row.id+'\')" href="javascript:void(0)">编辑</a>';  
		       
		            		return str;
		                } else {
		                    return '&nbsp&nbsp无照片';
		                }
		            }},
				]		
			],
			toolbar:[$.crudgrid.buttons.add,'-',$.crudgrid.buttons.edit,'-',$.crudgrid.buttons.remove,'-',$.crudgrid.buttons.search,'-',$.crudgrid.buttons.resetpwd,'-',$.crudgrid.buttons.refrsh,'-']
			})
		)
	}
</script>
<div  class="easyui-panel" title="学生管理" style="display:flex;flex-direction:column;"   data-options="fit:true">
	<p style="flex-grow:0">
		<span style="margin-left: 10px">选择班级:</span>
	    <select id="cc" class="easyui-combobox"  style="width:200px;" data-options="
	    	editable:false,
	    	panelHeight:200,
			url:'tbclass/list',
			valueField:'id',
			textField:'name',
			icons: [{
			iconCls:'icon-clear',
       		handler: function(e){
        		$(e.data.target).textbox('clear');
        		$('#XueShengYc').hide();
    			}
    		}]
   			">
		</select>
	</p>
	<div id="XueShengYc" style="flex-grow:1" >
		<table id="XueShengsTable"></table>
	</div>
</div>


